set(LF_PLATFORM_FILES ${CMAKE_CURRENT_LIST_DIR}/platform.c)


if(${CMAKE_SYSTEM_NAME} STREQUAL "Zephyr")
    zephyr_library_named(lf-platform-impl)
    zephyr_library_sources(${LF_PLATFORM_FILES})
    zephyr_library_link_libraries(kernel)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FlexPRET")
    add_library(lf-platform-impl STATIC)
    target_sources(lf-platform-impl PUBLIC ${LF_PLATFORM_FILES})
    target_link_libraries(lf-platform-impl PRIVATE fp-sdk)
else()
    add_library(lf-platform-impl STATIC)
    target_sources(lf-platform-impl PUBLIC ${LF_PLATFORM_FILES})
endif()

add_library(lf::platform-impl ALIAS lf-platform-impl)
target_link_libraries(lf-platform-impl PRIVATE lf::low-level-platform-api)
target_link_libraries(lf-platform-impl PRIVATE lf::platform-api)
message(STATUS "Applying preprocessor definitions to platform...")
macro(platform_define X)
    if(DEFINED ${X})
        message(STATUS ${X}=${${X}})
        target_compile_definitions(lf-platform-impl PUBLIC ${X}=${${X}})
    endif(DEFINED ${X})
endmacro()
platform_define(LF_SINGLE_THREADED)
platform_define(LOG_LEVEL)
platform_define(MODAL_REACTORS)
